import axios from 'axios';

const webapi = axios.create({
    timeout:6000,
})

// 请求拦截器
webapi.interceptors.request.use(
    (config)=>{

        const access_token ="";
        if(access_token){
            config.headers.Authorization = `Bearer ${access_token}`;
        }
        
        return config;
    },
    (error)=>{
        return Promise.reject(error);
    }
)

// 响应拦截器
webapi.interceptors.response.use(
    (response) =>{
        const res = response.data;
        return res;
    },
    (error) =>{
        return Promise.reject(error);
    }
)

export default webapi
